package com.zhy.sping.controller;

import com.zhy.sping.config.SystemConfig;
import com.zhy.sping.service.intf.CourseDocumentService;
import com.zhy.sping.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/course/")
public class CourseDocumentController {
    @Autowired
    private CourseDocumentService service;
    //@SentinelResource(fallback = "suggestError")//基于Sentinel服务降级
    @GetMapping("suggest.do")
    public R suggest(String msg, HttpServletRequest request){
        return service.suggest(request.getIntHeader(SystemConfig.HANDER_UID),msg);
    }

//    public R suggestError(String msg, HttpServletRequest request){
//        return R.fail("亲，网络异常");
//    }

    @GetMapping("queryhost.do")
    public R queryHost(){
        return service.queryHost();
    }

    @GetMapping("saveall.do")
    public R saveAll(int count){
        return service.saveAll(count);
    }

}
